<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>二维码</title>
    <link rel="stylesheet" href="${request.contextPath}/layuiadmin/layui/css/layui.css" media="all">
</head>
<style>
</style>
<body style="background-color: #F2F2F2;" >
<div style="padding: 20px; ">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body" style="text-align: center">
                    <!--startprint-->
                    <div id="imgDiv">
                        <img id="qrcode" src="" alt="" style="margin: 0 auto;text-align: center">
                    </div>
                    <!--endprint-->

<#--                    <a style="color: dodgerblue" href="${request.contextPath}/genQrCode?id=${id}?response-content-type=application/octet-stream" download>下载</a>-->
                        <a style="color: dodgerblue" href="javascript:;" id="print">打印</a>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="${request.contextPath}/layuiadmin/layui/layui.js"></script>

<script>
    layui.config({
        base: '${request.contextPath}/layuiadmin/modules/' //静态资源所在路径
    }).extend({
        xmSelect: 'xm-select'
    }).use(['form','jquery','laydate','xmSelect'], function(){
       var form=layui.form;
       var $=layui.$;
        var laydate = layui.laydate;
        var xmSelect = layui.xmSelect;


        $("#qrcode").attr("src", "${request.contextPath}/genQrCode?id=${id}");

        $("#print").click(function (){
            bdhtml=window.document.body.innerHTML;
            sprnstr="<!--startprint-->"; //开始打印标识字符串有17个字符
            eprnstr="<!--endprint-->"; //结束打印标识字符串
            prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); //从开始打印标识之后的内容
            prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); //截取开始标识和结束标识之间的内容
            window.document.body.innerHTML=prnhtml; //把需要打印的指定内容赋给body.innerHTML
            window.print(); //调用浏览器的打印功能打印指定区域
            window.location.reload();
            return false;
        })
    });
</script>

</body>
</html>